#!/usr/bin/env python
# -*- coding: utf-8 -*-

a = input()
n = []
m = 0
for i in a:
    if i not in n:
        n.append(i)
    else:
        j = n.index(i)
        m = max(m, len(n))
        n = n[j + 1:]
        n.append(i)
m = max(m, len(n))
print(m)
